package src.com.atguigu05.exer.exer4;

/**
 * ClassName: DivisionDemo
 * Package: src.com.atguigu05.exer.exer4
 * Description:
 *
 * @Author BuTang
 * @Create 2023/5/4 16:17
 * @Version 1.0
 */
public class DivisionDemo {
    public static void main(String[] args) {
        try {
            double a = Double.parseDouble(args[0]);
            double b = Double.parseDouble(args[1]);
            divide(a,b);
        } catch (BelowZeroException e) {
            System.out.println(e.getMessage());
        }catch (NumberFormatException e){
            System.out.println("数据不匹配");
        }catch (ArrayIndexOutOfBoundsException e){
            e.printStackTrace();
        }catch (ArithmeticException e ){
            e.printStackTrace();
        }

    }
    public static double divide(double a ,double b )throws BelowZeroException{
        if (a < 0| b < 0) {
            throw new BelowZeroException("输入数值为负数");
        }else{
            return a/b;
        }
    }
}
